﻿@model IEnumerable<MvcPrinciples.Models.Reward>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/_CommonLayout.cshtml";
}

<div>
	<h2>Here is the list of all rewards</h2>
	<div style="border: cornflowerblue; border-style: solid; border-width: 2px;">
		@foreach (var item in Model)
		{
			<div style="border: chocolate; border-style: solid; border-width: 2px; margin: 2px; padding: 5px; height: 60px">
				<div style="width: 20%; float: left">
					@string.Format("Title: {0}", item.Title)
				</div>
				<div style="width: 60%; float: right">
					@string.Format("Description: {0}", item.Description)
				</div>
				<div style="width: 20%; float: right;">
					@if (item.Image.Key != Guid.Empty)
					{
						<img src="@Url.Action("GetImage", new {id = item.Image.Key, type = item.Image.Value})" style="max-height: 50px; max-width: 100px" alt="Image" />
					}
				</div>
				<br /> @Html.ActionLink("Edit this reward", "EditReward", "Reward", new { id = item.Id }, null)
			</div>
		}
	</div>
	<div>
		<input type="button" value="Add reward" onclick="location.href = '@Url.Action("AddReward")'" />
	</div>
</div>

